import java.util.Arrays;

public class Rotate {

  public static void awser(int[] nums, int k){
      int n = nums.length;
      int[] newArr = new int[n];
      for (int i = 0; i < n; ++i) {
          newArr[(i + k) % n] = nums[i];
      }
      System.arraycopy(newArr, 0, nums, 0, n);

  }

    public static void main(String[] args) {
      int[] nums=new int[]{-1,-100,3,99};
        awser(nums,2);
    }
}
